package com.wyh.service.serviceImpl.gfiveImpl.tree_service_impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wyh.domain.vo.gfive.treeVo.BuildingUnitsVO;
import com.wyh.mapper.gfivemapper.tree_mapper.BuildingUnitsVOMapper;
import com.wyh.service.gfive.tree_service.IBuildingUnitsVOService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BuildingUnitsVOServiceImpl extends ServiceImpl<BuildingUnitsVOMapper, BuildingUnitsVO>
implements IBuildingUnitsVOService {
    @Autowired
    private BuildingUnitsVOMapper mapper;

    @Override
    public List<BuildingUnitsVO> findAll() {
        return mapper.selectAll();
    }

    @Override
    public List<BuildingUnitsVO> findListY(int id) {
        QueryWrapper<BuildingUnitsVO> wrapper = new QueryWrapper<>();
        wrapper.eq("parentid",id).eq("isconnected","Y");
        List<BuildingUnitsVO> buildingUnitsVOList = mapper.selectList(wrapper);
        return buildingUnitsVOList;
    }

    @Override
    public List<BuildingUnitsVO> findListN(int id) {
        QueryWrapper<BuildingUnitsVO> wrapper = new QueryWrapper<>();
        wrapper.eq("parentid",id).eq("isconnected","N");
        List<BuildingUnitsVO> buildingUnitsVOList = mapper.selectList(wrapper);
        return buildingUnitsVOList;
    }
}
